<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<input type="text" id="i1" placeholder="姓名">
<input type="text" id="i2" placeholder="年龄">
<input type="text" id="i3" placeholder="职位">
<hr>
<button onclick="addEmp1()">添加</button>

  <table>
    <tr>
      <th>姓名</th>
      <th>年龄</th>
      <th>职位</th>
    </tr>

  </table>
<script>

  function addEmp1()
  {
    let name =   document.getElementById("i1").value
    let age =  document.getElementById("i2").value
    let job =  document.getElementById("i3").value

    let nameTd =  document.createElement(`td`)
    let ageTd =  document.createElement("td")
    let jobTd =  document.createElement("td")
    let trA =  document.createElement("tr");

    nameTd.innerHTML = name;
    ageTd.innerHTML = age;
    jobTd.innerHTML = job;

    trA.append(nameTd,ageTd,jobTd)
    // document.getElementsByName('table')
    let htmlTableElement = document.querySelector(`table`);
    htmlTableElement.append(trA)
  }
</script>

</body>
</html>